<template>
  <div>
    <a-modal
      title="本合同包含的全部业务"
      v-model="visible"
      :width="1000"
      @cancel="onCancel"
    >
      <a-tabs type="card">
        <a-tab-pane key="1" tab="版权"></a-tab-pane>
        <a-tab-pane key="2" tab="专利"></a-tab-pane>
        <a-tab-pane key="3" tab="商标"></a-tab-pane>
      </a-tabs>
      <s-table
        bordered
        ref="table"
        size="middle"
        :row-key="(record) => record.cb_id"
        :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
        :columns="allColumns"
        :data="allData"
      >
        <template slot="sb_name" slot-scope="text">
          <a-input style="width: 150px" v-if="text == ''" type="text" placeholder="要修改的商标名"></a-input>
          <div v-else>{{text}}</div>
        </template>
        <template slot="status">
          <a-button size="small" type="danger" icon="edit">材料待提交</a-button>
        </template>
        <template slot="action">
          <a-button size="small" type="primary">重置</a-button>
        </template>
      </s-table>
      <div style="margin-bottom: 30px">
        <a-button :disabled="selectedRowKeys.length == 0" style="margin-right:5px" size="small" type="danger">批量上传</a-button>
        <a-button :disabled="selectedRowKeys.length == 0" size="small" type="primary">批量下载</a-button>
      </div>
    </a-modal>
  </div>
</template>

<script>
  import { STable } from '@/components'
  import businessColumns from '@/columns/business'
  import { getList } from '@/api/business'

  export default {
    props: {
      all: {
        type: String,
        default: ''
      }
    },
    components: {
      STable
    },
    name: 'ByAll',
    data () {
      return {
        visible: true,
        allColumns: businessColumns.tmModal1,
        allData: parameters => {
          return getList(Object.assign(parameters, this.queryParam)).then(res => {
            return res.result
          })
        },
        queryParam: {},
        selectedRowKeys: []
      }
    },
    created () {
      this.queryParam['filter[contract_no]'] = this.contractNo
    },
    methods: {
      onCancel () {
        this.visible = false
        this.$emit('cancel', this.visible)
      },
      onSelectChange (selectedRowKeys) {
        this.selectedRowKeys = selectedRowKeys
      }
    }
  }
</script>

<style scoped>

</style>
